﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace DoAn_BumTruong_DesignPattern.Admin
{
    public partial class Article : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                LoadData();
            }
        }
        Facades fcarticle = new Facades();
        //Load Data
        private void LoadData()
        {
            int howManyPage = 0;
            string moduleID = Request.QueryString["ArticleID"] ?? "";
            string page = Request.QueryString["Page"] ?? "1";
            string fistPageUrl = Link.ToArticleAdmin("1");
            string pageUrl = Link.ToArticleAdmin("{0}");
            RepeaterArticle.DataSource = fcarticle.PagingArticle(page, out howManyPage).OrderByDescending(ar=>ar.ArticleID);
            RepeaterArticle.DataBind();
            PagesButtons.ShowPage(int.Parse(page), howManyPage, fistPageUrl, pageUrl, true);
        }
    }
}